Skip to content

Websocket client#15

Merged
tmunzer-AIDE merged 17 commits intomainfrom
websocket-client
Mar 13, 2026
Merged

Websocket client#15
tmunzer-AIDE merged 17 commits intomainfrom
websocket-client

Conversation

@tmunzer-AIDE
Copy link
Copy Markdown
Collaborator

No description provided.

Major refactoring to reduce code duplication and address security concerns:

* feat(__api_request): consolidate retry logic into _request_with_retry
  - Extract HTTP operations into inner functions (_do_get, _do_post, etc.)
  - Centralize error handling for all HTTP methods
  - Reduces code duplication by ~55 lines

* security(__api_session): remove SSL verification bypass in Vault client
  - Remove verify=False from hvac.Client initialization
  - Make vault attributes private (_vault_url, _vault_path, etc.)
  - Improve vault credentials cleanup in finally block

* feat(__api_session): improve session management
  - Add _new_session() helper for consistent session initialization
  - Add validate parameter to set_api_token() for optional token validation
  - Fix delete_api_token() to return APIResponse instead of Response
  - Use mist_delete() method instead of raw session.delete()

* perf(__init__): implement lazy loading for heavy subpackages
  - Defer api and cli imports until accessed
  - Improves initial import performance

* fix(__logger): correct logging sanitization
  - Use getMessage() instead of direct msg access
  - Clear record.args after sanitization to prevent re-formatting

This refactoring improves maintainability, security, and performance without
changing the public API surface.
  refactor: rename utils to device_utils and adopt camelCase public API

  Reorganize device utility modules from `mistapi.utils` to
  `mistapi.device_utils` with a clean separation between internal
  implementations (`__tools/`) and public-facing device modules
  (ap, ex, srx, ssr). Public function names now use camelCase
  (e.g. retrieveArpTable, monitorTraffic) for consistency with the
  auto-generated REST API.

  Also adds comprehensive unit tests for api_request, api_response,
  api_session, models, pagination, logger, init, and websocket_client.
tmunzer-AIDE and others added 6 commits March 13, 2026 20:58
- Updated `searchOrgNacClients` and `searchSiteNacClients` to correct status options from 'session_ended' to 'session_stopped'.
- Rearranged parameters in `searchOrgWanClients`, `searchSiteWanClients`, and `searchSiteWirelessClients` for consistency and clarity.
- Added new parameters `cert_expiry_duration` and `psk_name` to `searchSiteNacClients` and `searchSiteWirelessClients` respectively.
- Removed unused parameters and cleaned up query parameter handling in various search functions.
- Enhanced logging and sanitization in `test_logger.py` to ensure sensitive data is properly redacted.
- Deleted obsolete test file `test.py` to streamline the test suite.
- Improved test readability and structure across multiple test files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tmunzer-AIDE tmunzer-AIDE merged commit 2fcb483 into main Mar 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant